<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>来石登记——来石管理——板房人员——鑫四合珠宝管理</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="huyuzhu">
<!-- Le styles -->
<link href="${pageContext.request.contextPath}/css/bootstrap.css" rel="stylesheet" type="text/css">
<link href="${pageContext.request.contextPath}/css/base.css" rel="stylesheet">
<link href="${pageContext.request.contextPath}/css/main.css" rel="stylesheet">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-affix.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/bootstrap-modal.js"></script>
<script type="text/javascript">
$(document).ready(function(){ 
	$('#customer').change(function(){ 
		var customerinfo = $("#customerinfo").html();	
		var selected = $(this).children('option:selected').val();
		$("#customerid").html(selected);
		var list = new Array();
		list = customerinfo.split(";");
		for(var i=0;i<list.length-1;i++){
			 var customer = list[i];
			 var temp = new Array();
			 temp = customer.split(":");
			 if($.trim(temp[0])==selected){
				 $("#orderName").html(temp[1]);
				 break;
			 }
		}
	}); 
	}); 

<s:if test="message!=null">
$(document).ready(function(){
	$("#myModal").modal('show');
});
</s:if>

function add(){
	clear();
	$("#AddForm").submit();
} 

function clear(){
	$("#LoginidMsg").html("");
	$("#NameMsg").html("");
	$("#UserTypeMsg").html("");
	$("#GenderMsg").html("");
	$("#TelephoneMsg").html("");
	$("#QQMsg").html("");
	$("#EMailMsg").html("");
	$("#EnrollTimeMsg").html("");
	$("#RemarkMsg").html("");
	$("#message").html("");
}
</script>
</head>
<body>
<!-- 头部 -->
<s:include value="../header.jsp"/>
<!-- 主内容区开始 -->
<div class="hide" id="customerinfo">
	<s:iterator value="customerList"><s:property value="customerid"/>:<s:property value="orderName"/>;</s:iterator>
</div>
<div class="conBox clearfix">
  <s:if test="#session.UserInfo.userVO.userType==1">
	<s:include value="../a/menu.jsp">
	<s:param name="menuIndex" value="4"/>
</s:include>
</s:if>
<s:else>
<s:include value="menu.jsp">
	<s:param name="menuIndex" value="4"/>
</s:include>
</s:else>
  <div class="mainBox">
    <h1>来石登记</h1>
    <s:form action="addingMaterialStone" id="AddForm" cssClass="form-horizontal">
      <div class="control-group">
        <label class="control-label">登记单号：</label>
        <div class="controls">
          <span class="uneditable-input"><s:property value="materialStone.msid"/></span>
          <s:hidden name="materialStone.msid"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="khhao">客户名：</label>
        <div class="controls">
           <s:select id="customer" name="materialStone.customerid" list="customerList" listKey="customerid" 
           listValue="customerName" headerKey="" headerValue="请选择客户名"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="">客户号：</label>
        <div class="controls">
          <span id="customerid" class="uneditable-input"></span>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label">下单名：</label>
        <div class="controls">
          <span id="orderName" class="uneditable-input"></span>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" >关联订单：</label>
        <div class="controls">
          <s:select name="materialStone.orderid" list="orderList" listKey="orderid" 
           listValue="orderid" headerKey="" headerValue="请选关联订单号"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label">石料：</label>
        <div class="controls">
          <s:select name="materialStone.stoneMaterial" list="stoneAttrList" listKey="attrName" cssClass="span2" listValue="attrName"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label">颜色：</label>
        <div class="controls">
        <s:select name="materialStone.color" list="colorAttrList" listKey="attrName" cssClass="span2" listValue="attrName"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label">净度：</label>
        <div class="controls">
         <s:select name="materialStone.neatness" list="neatnessAttrList" listKey="attrName" cssClass="span2" listValue="attrName"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="shihao">石号：</label>
        <div class="controls">
          <s:textfield name="materialStone.stoneid"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="nb">数量：</label>
        <div class="controls">
          <s:textfield name="materialStone.quantity"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="weight">重量：</label>
        <div class="controls">
          <s:textfield name="materialStone.weight"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="">经手：</label>
        <div class="controls">
          <s:textfield name="materialStone.handlePerson"/>
        </div>
      </div>
      <div class="control-group">
        <label class="control-label" for="">说明：</label>
        <div class="controls">
          <span class="uneditable-input" style="width:500px;">客户信息通过客户号选择自动填入，关联订单会自动根据客户信息做过滤。</span>
        </div>
      </div>
      <div class="form-actions">
        <input type="button" class="btn btn-primary" value="保存" onclick="add();"/>
        <s:reset cssClass="btn" value="重置"/>
        <s:a action="queryMaterialStoneList" cssClass="btn">返回</s:a>
      </div>
    </s:form>
  </div>
</div>
<!-- 主内容区结束 --> 
<!-- 尾部 -->
<s:include value="../bottom.jsp"/>

<div class="modal hide fade" id="myModal">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>操作提示</h3>
  </div>
  <div class="modal-body">
    <p><s:property  value="message"/></p>
  </div>
  <div class="modal-footer">
    <a href="#" class="btn btn-primary" data-dismiss="modal">确定</a>
  </div>
</div>

</body>
</html>